package bs.controller;

import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONArray;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import bs.service.LangService;
import bs.util.ResponseUtil;

/**
 * 
 * LangController
 *
 * @author 姜治昊
 * @time 2017年12月5日 上午11:27:33
 */
@Controller
@RequestMapping("lang")
public class LangController {
	
	@Autowired
	private LangService langService;
	
	@RequestMapping(value="list", method=RequestMethod.GET, produces="application/json;charset=UTF-8")
	public void list(HttpServletResponse response, @RequestParam(value="q", required=false, defaultValue="") String q) {
		ResponseUtil.write(response, JSONArray.fromObject(langService.getLanguageList(q)));
	}
	
}
